package com.example.arena;

import java.io.InputStream;


import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

/**
 * 
 * @author Dani
 * @greets Whoever provided the method "leerFichero" below
 */
public class HelpActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_help);
		//Four easy steps:
		//We load the file
InputStream iFile = getResources().openRawResource(R.raw.help);
       
        // Then load the textView
        TextView helpText = (TextView) findViewById(R.id.txtHelp);
        
        // Then load the content of the file
        String strFile = leerFichero(iFile);
        
        // And finally, we set the textView that content
        helpText.setText(strFile);
        
	}

	/**
	 * Function that reads a file and returns it content as an string
	 * @param iFile
	 * @return
	 */
	private String leerFichero(InputStream iFile) {
	    try {
	        return new java.util.Scanner(iFile,"UTF-8").useDelimiter("\\A").next();
	    } catch (java.util.NoSuchElementException e) {
	        return "";
	    } 
		
	}


}
